/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 *
 * $Rev: 18 $
 * $LastChangedDate: 2009-04-14 16:11:25 +0000 (Tue, 14 Apr 2009) $
 */

package Main;

import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import java.util.*;
/**
 * @author moreto
 */
public class MainMIDlet extends MIDlet implements CommandListener, ItemCommandListener {

    private boolean midletPaused = false;

    // Defining variables:
    private IntervalTimer updater;
    private Timer timer;
    private boolean timerRunning;

    //<editor-fold defaultstate="collapsed" desc=" Generated Fields ">//GEN-BEGIN:|fields|0|
    private Form FormSettings;
    private DateField dateFieldAtual;
    private TextField textFieldTimer;
    private List list;
    private Alert AlertAbout;
    private ResultCanvas resultCanvas;
    private Command exitCommand;
    private Command StartCommand;
    private Command exitCommand1;
    private Command backCommand;
    private Command exitCanvasCommand;
    private Command cancelCanvasCommand;
    private Command itemCommand1;
    private Command itemCommand;
    private Image image1;
    //</editor-fold>//GEN-END:|fields|0|

    /**
     * The MainMIDlet constructor.
     */
    public MainMIDlet() {
    }

    //<editor-fold defaultstate="collapsed" desc=" Generated Methods ">//GEN-BEGIN:|methods|0|
    //</editor-fold>//GEN-END:|methods|0|

    //<editor-fold defaultstate="collapsed" desc=" Generated Method: initialize ">//GEN-BEGIN:|0-initialize|0|0-preInitialize
    /**
     * Initilizes the application.
     * It is called only once when the MIDlet is started. The method is called before the <code>startMIDlet</code> method.
     */
    private void initialize() {//GEN-END:|0-initialize|0|0-preInitialize
        // write pre-initialize user code here
//GEN-LINE:|0-initialize|1|0-postInitialize
        // write post-initialize user code here
    }//GEN-BEGIN:|0-initialize|2|
    //</editor-fold>//GEN-END:|0-initialize|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Method: startMIDlet ">//GEN-BEGIN:|3-startMIDlet|0|3-preAction
    /**
     * Performs an action assigned to the Mobile Device - MIDlet Started point.
     */
    public void startMIDlet() {//GEN-END:|3-startMIDlet|0|3-preAction
        // write pre-action user code here
        switchDisplayable(null, getList());//GEN-LINE:|3-startMIDlet|1|3-postAction
        // write post-action user code here
    }//GEN-BEGIN:|3-startMIDlet|2|
    //</editor-fold>//GEN-END:|3-startMIDlet|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Method: resumeMIDlet ">//GEN-BEGIN:|4-resumeMIDlet|0|4-preAction
    /**
     * Performs an action assigned to the Mobile Device - MIDlet Resumed point.
     */
    public void resumeMIDlet() {//GEN-END:|4-resumeMIDlet|0|4-preAction
        // write pre-action user code here
//GEN-LINE:|4-resumeMIDlet|1|4-postAction
        // write post-action user code here
    }//GEN-BEGIN:|4-resumeMIDlet|2|
    //</editor-fold>//GEN-END:|4-resumeMIDlet|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Method: switchDisplayable ">//GEN-BEGIN:|5-switchDisplayable|0|5-preSwitch
    /**
     * Switches a current displayable in a display. The <code>display</code> instance is taken from <code>getDisplay</code> method. This method is used by all actions in the design for switching displayable.
     * @param alert the Alert which is temporarily set to the display; if <code>null</code>, then <code>nextDisplayable</code> is set immediately
     * @param nextDisplayable the Displayable to be set
     */
    public void switchDisplayable(Alert alert, Displayable nextDisplayable) {//GEN-END:|5-switchDisplayable|0|5-preSwitch
        // write pre-switch user code here
        Display display = getDisplay();//GEN-BEGIN:|5-switchDisplayable|1|5-postSwitch
        if (alert == null) {
            display.setCurrent(nextDisplayable);
        } else {
            display.setCurrent(alert, nextDisplayable);
        }//GEN-END:|5-switchDisplayable|1|5-postSwitch
        // write post-switch user code here
    }//GEN-BEGIN:|5-switchDisplayable|2|
    //</editor-fold>//GEN-END:|5-switchDisplayable|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Method: commandAction for Displayables ">//GEN-BEGIN:|7-commandAction|0|7-preCommandAction
    /**
     * Called by a system to indicated that a command has been invoked on a particular displayable.
     * @param command the Command that was invoked
     * @param displayable the Displayable where the command was invoked
     */
    public void commandAction(Command command, Displayable displayable) {//GEN-END:|7-commandAction|0|7-preCommandAction
        // write pre-action user code here
        if (displayable == FormSettings) {//GEN-BEGIN:|7-commandAction|1|18-preAction
            if (command == StartCommand) {//GEN-END:|7-commandAction|1|18-preAction
                // write pre-action user code here
                StartCanvas();//GEN-LINE:|7-commandAction|2|18-postAction
                // write post-action user code here
            } else if (command == backCommand) {//GEN-LINE:|7-commandAction|3|51-preAction
                // write pre-action user code here
                switchDisplayable(null, getList());//GEN-LINE:|7-commandAction|4|51-postAction
                // write post-action user code here
            } else if (command == exitCommand) {//GEN-LINE:|7-commandAction|5|16-preAction
                // write pre-action user code here
                exitMIDlet();//GEN-LINE:|7-commandAction|6|16-postAction
                // write post-action user code here
            }//GEN-BEGIN:|7-commandAction|7|35-preAction
        } else if (displayable == list) {
            if (command == List.SELECT_COMMAND) {//GEN-END:|7-commandAction|7|35-preAction
                // write pre-action user code here
                listAction();//GEN-LINE:|7-commandAction|8|35-postAction
                // write post-action user code here
            } else if (command == exitCommand) {//GEN-LINE:|7-commandAction|9|118-preAction
                // write pre-action user code here
                exitMIDlet();//GEN-LINE:|7-commandAction|10|118-postAction
                // write post-action user code here
            }//GEN-BEGIN:|7-commandAction|11|92-preAction
        } else if (displayable == resultCanvas) {
            if (command == cancelCanvasCommand) {//GEN-END:|7-commandAction|11|92-preAction
                // write pre-action user code here
                OnCanvasCancel();//GEN-LINE:|7-commandAction|12|92-postAction
                // write post-action user code here
            } else if (command == exitCanvasCommand) {//GEN-LINE:|7-commandAction|13|87-preAction
                // write pre-action user code here
                exitMIDlet();//GEN-LINE:|7-commandAction|14|87-postAction
                // write post-action user code here
            }//GEN-BEGIN:|7-commandAction|15|7-postCommandAction
        }//GEN-END:|7-commandAction|15|7-postCommandAction
        // write post-action user code here
    }//GEN-BEGIN:|7-commandAction|16|
    //</editor-fold>//GEN-END:|7-commandAction|16|


    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: FormSettings ">//GEN-BEGIN:|14-getter|0|14-preInit
    /**
     * Returns an initiliazed instance of FormSettings component.
     * @return the initialized component instance
     */
    public Form getFormSettings() {
        if (FormSettings == null) {//GEN-END:|14-getter|0|14-preInit
            // write pre-init user code here
            FormSettings = new Form("Settings", new Item[] { getDateFieldAtual(), getTextFieldTimer() });//GEN-BEGIN:|14-getter|1|14-postInit
            FormSettings.addCommand(getExitCommand());
            FormSettings.addCommand(getStartCommand());
            FormSettings.addCommand(getBackCommand());
            FormSettings.setCommandListener(this);//GEN-END:|14-getter|1|14-postInit
            // write post-init user code here
        }//GEN-BEGIN:|14-getter|2|
        return FormSettings;
    }
    //</editor-fold>//GEN-END:|14-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: exitCommand ">//GEN-BEGIN:|15-getter|0|15-preInit
    /**
     * Returns an initiliazed instance of exitCommand component.
     * @return the initialized component instance
     */
    public Command getExitCommand() {
        if (exitCommand == null) {//GEN-END:|15-getter|0|15-preInit
            // write pre-init user code here
            exitCommand = new Command("Exit", Command.EXIT, 0);//GEN-LINE:|15-getter|1|15-postInit
            // write post-init user code here
        }//GEN-BEGIN:|15-getter|2|
        return exitCommand;
    }
    //</editor-fold>//GEN-END:|15-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: StartCommand ">//GEN-BEGIN:|17-getter|0|17-preInit
    /**
     * Returns an initiliazed instance of StartCommand component.
     * @return the initialized component instance
     */
    public Command getStartCommand() {
        if (StartCommand == null) {//GEN-END:|17-getter|0|17-preInit
            // write pre-init user code here
            StartCommand = new Command("Start", Command.OK, 0);//GEN-LINE:|17-getter|1|17-postInit
            // write post-init user code here
        }//GEN-BEGIN:|17-getter|2|
        return StartCommand;
    }
    //</editor-fold>//GEN-END:|17-getter|2|





    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: list ">//GEN-BEGIN:|34-getter|0|34-preInit
    /**
     * Returns an initiliazed instance of list component.
     * @return the initialized component instance
     */
    public List getList() {
        if (list == null) {//GEN-END:|34-getter|0|34-preInit
            // write pre-init user code here
            list = new List("Mobile Jupiter by Moreto", Choice.IMPLICIT);//GEN-BEGIN:|34-getter|1|34-postInit
            list.append("Start", null);
            list.append("Settings", null);
            list.append("About", null);
            list.addCommand(getExitCommand());
            list.setCommandListener(this);
            list.setSelectedFlags(new boolean[] { true, false, false });//GEN-END:|34-getter|1|34-postInit
            // write post-init user code here
        }//GEN-BEGIN:|34-getter|2|
        return list;
    }
    //</editor-fold>//GEN-END:|34-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Method: listAction ">//GEN-BEGIN:|34-action|0|34-preAction
    /**
     * Performs an action assigned to the selected list element in the list component.
     */
    public void listAction() {//GEN-END:|34-action|0|34-preAction
        // enter pre-action user code here
        String __selectedString = getList().getString(getList().getSelectedIndex());//GEN-BEGIN:|34-action|1|37-preAction
        if (__selectedString != null) {
            if (__selectedString.equals("Start")) {//GEN-END:|34-action|1|37-preAction
                // write pre-action user code here
                StartCanvas();//GEN-LINE:|34-action|2|37-postAction
                // write post-action user code here
            } else if (__selectedString.equals("Settings")) {//GEN-LINE:|34-action|3|39-preAction
                // write pre-action user code here
                switchDisplayable(null, getFormSettings());//GEN-LINE:|34-action|4|39-postAction
                // write post-action user code here
            } else if (__selectedString.equals("About")) {//GEN-LINE:|34-action|5|53-preAction
                // write pre-action user code here
                switchDisplayable(getAlertAbout(), getList());//GEN-LINE:|34-action|6|53-postAction
                // write post-action user code here
            }//GEN-BEGIN:|34-action|7|34-postAction
        }//GEN-END:|34-action|7|34-postAction
        // enter post-action user code here
    }//GEN-BEGIN:|34-action|8|
    //</editor-fold>//GEN-END:|34-action|8|





    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: exitCommand1 ">//GEN-BEGIN:|45-getter|0|45-preInit
    /**
     * Returns an initiliazed instance of exitCommand1 component.
     * @return the initialized component instance
     */
    public Command getExitCommand1() {
        if (exitCommand1 == null) {//GEN-END:|45-getter|0|45-preInit
            // write pre-init user code here
            exitCommand1 = new Command("Exit", Command.EXIT, 0);//GEN-LINE:|45-getter|1|45-postInit
            // write post-init user code here
        }//GEN-BEGIN:|45-getter|2|
        return exitCommand1;
    }
    //</editor-fold>//GEN-END:|45-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: backCommand ">//GEN-BEGIN:|50-getter|0|50-preInit
    /**
     * Returns an initiliazed instance of backCommand component.
     * @return the initialized component instance
     */
    public Command getBackCommand() {
        if (backCommand == null) {//GEN-END:|50-getter|0|50-preInit
            // write pre-init user code here
            backCommand = new Command("Back", Command.BACK, 0);//GEN-LINE:|50-getter|1|50-postInit
            // write post-init user code here
        }//GEN-BEGIN:|50-getter|2|
        return backCommand;
    }
    //</editor-fold>//GEN-END:|50-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: AlertAbout ">//GEN-BEGIN:|54-getter|0|54-preInit
    /**
     * Returns an initiliazed instance of AlertAbout component.
     * @return the initialized component instance
     */
    public Alert getAlertAbout() {
        if (AlertAbout == null) {//GEN-END:|54-getter|0|54-preInit
            // write pre-init user code here
            AlertAbout = new Alert("About Mobile Jupiter 1.0", "Mobile Jupiter 1.0 is an J2ME MIDlet application to show the current position of the galilean moons of Jupiter.\nIt is intially designed to be used in binocular observations.\nDeveloped by Miguel Moreto in Florianopolis, Brazil.\n$Rev: 18 $", getImage1(), AlertType.INFO);//GEN-BEGIN:|54-getter|1|54-postInit
            AlertAbout.setTimeout(Alert.FOREVER);//GEN-END:|54-getter|1|54-postInit
            // write post-init user code here
        }//GEN-BEGIN:|54-getter|2|
        return AlertAbout;
    }
    //</editor-fold>//GEN-END:|54-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: dateFieldAtual ">//GEN-BEGIN:|56-getter|0|56-preInit
    /**
     * Returns an initiliazed instance of dateFieldAtual component.
     * @return the initialized component instance
     */
    public DateField getDateFieldAtual() {
        if (dateFieldAtual == null) {//GEN-END:|56-getter|0|56-preInit
            // write pre-init user code here
            dateFieldAtual = new DateField("Actual time/date:", DateField.DATE_TIME, java.util.TimeZone.getDefault());//GEN-BEGIN:|56-getter|1|56-postInit
            dateFieldAtual.addCommand(getItemCommand1());
            dateFieldAtual.setItemCommandListener(this);
            dateFieldAtual.setDate(new java.util.Date(System.currentTimeMillis()));//GEN-END:|56-getter|1|56-postInit
            // write post-init user code here
        }//GEN-BEGIN:|56-getter|2|
        return dateFieldAtual;
    }
    //</editor-fold>//GEN-END:|56-getter|2|





    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: resultCanvas ">//GEN-BEGIN:|84-getter|0|84-preInit
    /**
     * Returns an initiliazed instance of resultCanvas component.
     * @return the initialized component instance
     */
    public ResultCanvas getResultCanvas() {
        if (resultCanvas == null) {//GEN-END:|84-getter|0|84-preInit
            // write pre-init user code here
            resultCanvas = new ResultCanvas();//GEN-BEGIN:|84-getter|1|84-postInit
            resultCanvas.setTitle("resultCanvas");
            resultCanvas.addCommand(getExitCanvasCommand());
            resultCanvas.addCommand(getCancelCanvasCommand());
            resultCanvas.setCommandListener(this);
            resultCanvas.setFullScreenMode(true);//GEN-END:|84-getter|1|84-postInit
            // write post-init user code here
        }//GEN-BEGIN:|84-getter|2|
        return resultCanvas;
    }
    //</editor-fold>//GEN-END:|84-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: exitCanvasCommand ">//GEN-BEGIN:|86-getter|0|86-preInit
    /**
     * Returns an initiliazed instance of exitCanvasCommand component.
     * @return the initialized component instance
     */
    public Command getExitCanvasCommand() {
        if (exitCanvasCommand == null) {//GEN-END:|86-getter|0|86-preInit
            // write pre-init user code here
            exitCanvasCommand = new Command("Exit", Command.EXIT, 0);//GEN-LINE:|86-getter|1|86-postInit
            // write post-init user code here
        }//GEN-BEGIN:|86-getter|2|
        return exitCanvasCommand;
    }
    //</editor-fold>//GEN-END:|86-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: cancelCanvasCommand ">//GEN-BEGIN:|91-getter|0|91-preInit
    /**
     * Returns an initiliazed instance of cancelCanvasCommand component.
     * @return the initialized component instance
     */
    public Command getCancelCanvasCommand() {
        if (cancelCanvasCommand == null) {//GEN-END:|91-getter|0|91-preInit
            // write pre-init user code here
            cancelCanvasCommand = new Command("Cancel", Command.CANCEL, 0);//GEN-LINE:|91-getter|1|91-postInit
            // write post-init user code here
        }//GEN-BEGIN:|91-getter|2|
        return cancelCanvasCommand;
    }
    //</editor-fold>//GEN-END:|91-getter|2|



    //<editor-fold defaultstate="collapsed" desc=" Generated Method: StartCanvas ">//GEN-BEGIN:|109-entry|0|110-preAction
    /**
     * Performs an action assigned to the StartCanvas entry-point.
     */
    public void StartCanvas() {//GEN-END:|109-entry|0|110-preAction
        // write pre-action user code here
        switchDisplayable(null, getResultCanvas());//GEN-LINE:|109-entry|1|110-postAction
        // write post-action user code here

        // Getting the refresh time value from de form:
        String timerStr = getTextFieldTimer().getString(); // Reading the timer from the form.
        java.util.Date date = getDateFieldAtual().getDate(); // Getting the date.

        long ActualTime = date.getTime(); // Actual time in milliseconds setted in the form.
        long timerValue = Integer.parseInt(timerStr); // Refresh time in milliseconds.
        ResultCanvas canvas = getResultCanvas(); // getting the canvas instance.
        canvas.setDate(ActualTime);

        if (timerRunning == false) {
            // Create thread with the date and time setted in the interface:
            updater = new IntervalTimer(ActualTime,timerValue*1000);
            updater.setCanvas(getResultCanvas());
            timer = new Timer();
            timer.schedule(updater, timerValue*1000, timerValue*1000);
            timerRunning = true;
        }
    }//GEN-BEGIN:|109-entry|2|
    //</editor-fold>//GEN-END:|109-entry|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Method: OnCanvasCancel ">//GEN-BEGIN:|114-entry|0|115-preAction
    /**
     * Performs an action assigned to the OnCanvasCancel entry-point.
     */
    public void OnCanvasCancel() {//GEN-END:|114-entry|0|115-preAction
        // write pre-action user code here
        if (timerRunning){
            timer.cancel();
            timerRunning = false;
            updater.cancel();
        }
        switchDisplayable(null, getList());//GEN-LINE:|114-entry|1|115-postAction
        // write post-action user code here
    }//GEN-BEGIN:|114-entry|2|
    //</editor-fold>//GEN-END:|114-entry|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: textFieldTimer ">//GEN-BEGIN:|120-getter|0|120-preInit
    /**
     * Returns an initiliazed instance of textFieldTimer component.
     * @return the initialized component instance
     */
    public TextField getTextFieldTimer() {
        if (textFieldTimer == null) {//GEN-END:|120-getter|0|120-preInit
            // write pre-init user code here
            textFieldTimer = new TextField("Refresh Time [sec]", "60", 32, TextField.NUMERIC);//GEN-BEGIN:|120-getter|1|120-postInit
            textFieldTimer.setItemCommandListener(this);//GEN-END:|120-getter|1|120-postInit
            // write post-init user code here
        }//GEN-BEGIN:|120-getter|2|
        return textFieldTimer;
    }
    //</editor-fold>//GEN-END:|120-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Method: commandAction for Items ">//GEN-BEGIN:|8-itemCommandAction|0|8-preItemCommandAction
    /**
     * Called by a system to indicated that a command has been invoked on a particular item.
     * @param command the Command that was invoked
     * @param displayable the Item where the command was invoked
     */
    public void commandAction(Command command, Item item) {//GEN-END:|8-itemCommandAction|0|8-preItemCommandAction
        // write pre-action user code here
        if (item == dateFieldAtual) {//GEN-BEGIN:|8-itemCommandAction|1|128-preAction
            if (command == itemCommand1) {//GEN-END:|8-itemCommandAction|1|128-preAction
                // write pre-action user code here
                getDateFieldAtual().setDate(new java.util.Date(System.currentTimeMillis()));//GEN-LINE:|8-itemCommandAction|2|128-postAction
                // write post-action user code here
            }//GEN-BEGIN:|8-itemCommandAction|3|8-postItemCommandAction
        }//GEN-END:|8-itemCommandAction|3|8-postItemCommandAction
        // write post-action user code here
    }//GEN-BEGIN:|8-itemCommandAction|4|
    //</editor-fold>//GEN-END:|8-itemCommandAction|4|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: itemCommand ">//GEN-BEGIN:|123-getter|0|123-preInit
    /**
     * Returns an initiliazed instance of itemCommand component.
     * @return the initialized component instance
     */
    public Command getItemCommand() {
        if (itemCommand == null) {//GEN-END:|123-getter|0|123-preInit
            // write pre-init user code here
            itemCommand = new Command("Set to actual time", Command.ITEM, 0);//GEN-LINE:|123-getter|1|123-postInit
            // write post-init user code here
        }//GEN-BEGIN:|123-getter|2|
        return itemCommand;
    }
    //</editor-fold>//GEN-END:|123-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: itemCommand1 ">//GEN-BEGIN:|127-getter|0|127-preInit
    /**
     * Returns an initiliazed instance of itemCommand1 component.
     * @return the initialized component instance
     */
    public Command getItemCommand1() {
        if (itemCommand1 == null) {//GEN-END:|127-getter|0|127-preInit
            // write pre-init user code here
            itemCommand1 = new Command("Reset", Command.ITEM, 0);//GEN-LINE:|127-getter|1|127-postInit
            // write post-init user code here
        }//GEN-BEGIN:|127-getter|2|
        return itemCommand1;
    }
    //</editor-fold>//GEN-END:|127-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: image1 ">//GEN-BEGIN:|130-getter|0|130-preInit
    /**
     * Returns an initiliazed instance of image1 component.
     * @return the initialized component instance
     */
    public Image getImage1() {
        if (image1 == null) {//GEN-END:|130-getter|0|130-preInit
            // write pre-init user code here
            try {//GEN-BEGIN:|130-getter|1|130-@java.io.IOException
                image1 = Image.createImage("/jupiter.jpg");
            } catch (java.io.IOException e) {//GEN-END:|130-getter|1|130-@java.io.IOException
                e.printStackTrace();
            }//GEN-LINE:|130-getter|2|130-postInit
            // write post-init user code here
        }//GEN-BEGIN:|130-getter|3|
        return image1;
    }
    //</editor-fold>//GEN-END:|130-getter|3|

    /**
     * Returns a display instance.
     * @return the display instance.
     */
    public Display getDisplay () {
        return Display.getDisplay(this);
    }

    /**
     * Exits MIDlet.
     */
    public void exitMIDlet() {
        
        timer.cancel();
        switchDisplayable (null, null);
        destroyApp(true);
        notifyDestroyed();
    }

    /**
     * Called when MIDlet is started.
     * Checks whether the MIDlet have been already started and initialize/starts or resumes the MIDlet.
     */
    public void startApp() {
        if (midletPaused) {
            resumeMIDlet ();
        } else {
            initialize ();
            startMIDlet ();
        }
        midletPaused = false;
    }

    /**
     * Called when MIDlet is paused.
     */
    public void pauseApp() {
        midletPaused = true;
    }

    /**
     * Called to signal the MIDlet to terminate.
     * @param unconditional if true, then the MIDlet has to be unconditionally terminated and all resources has to be released.
     */
    public void destroyApp(boolean unconditional) {
    }

}
